package com.dongwq

class User {

	String username;
	String firstName;
	String lastName;
	String password;
	transient String repassword;
	String uri;
	String email;
	
	static hasMany = [modules:Module]
	
	//static searchable = true
	
	static constraints = {
		username(blank:false,size:3..16)
		firstName(blank:false,size:1..16)
		lastName(blank:false,size:1..16)
		password(blank:false,size:6..16, validator:{val,obj->
			if(val != obj.repassword)
				return false
			})
		repassword(blank:false)
		email(email:true)
	}
	
	static mapping = {
		sort 'username';
	}
	
	String toString()
	{
		username
	} 
}
